package com.shangqing.web.controller.system;

import com.shangqing.common.core.domain.AjaxResult;
import com.shangqing.system.droughtinformation.entity.*;
import com.shangqing.system.windinfomation.entity.WindGrade;
import com.shangqing.system.windinfomation.entity.WindWarning;
import com.shangqing.system.windinfomation.entity.Windinformation;
import com.shangqing.system.windinfomation.service.IwindInfomationSercice;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/windinformation")
@Api(tags = "大风", description = "大风相关接口")
public class WindInformationController {

    @Autowired
    private IwindInfomationSercice iwindInfomationSercice;
    @GetMapping("/selectwindInformation")
    @ApiOperation(value = "大风信息", notes = "", httpMethod = "GET")
    public AjaxResult selWindInformation() {
        List<Windinformation> windinformations = null;
        try {
            windinformations = iwindInfomationSercice.getAllInfo();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return AjaxResult.success("查询成功", windinformations);
    }

    @GetMapping("/selectWindGrage")
    @ApiOperation(value = "大风等级", notes = "", httpMethod = "GET")
    public AjaxResult selWindGrage() {
        List<WindGrade> windGrades = null;
        try {
            windGrades = iwindInfomationSercice.getWindGrade();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return AjaxResult.success("查询成功", windGrades);
    }
    @GetMapping("/selectWindWarning")
    @ApiOperation(value = "大风预警信息", notes = "", httpMethod = "GET")
    public AjaxResult selWindWarning() {
        List<WindWarning> windWarnings = null;
        try {
            windWarnings = iwindInfomationSercice.getWindWarning();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return AjaxResult.success("查询成功", windWarnings);
    }
}
